export const createObjectURL = file => {
  const createObjectURL =
    window.createObjectURL ||
    window.URL.createObjectURL ||
    window.webkitURL.createObjectURL ||
    (() => null)
  return createObjectURL(new Blob([file]), { type: file.type })
}

export const revokeObjectURL = url => {
  const revokeObjectURL =
    window.revokeObjectURL ||
    window.URL.revokeObjectURL ||
    window.webkitURL.revokeObjectURL ||
    (() => null)
  return revokeObjectURL(url)
}

export const getFileType = url => (/[^.]\w*$/.exec(url) || '').toString()
